package com.example.test.serviceImpl;

import com.example.test.mapper.WybzMapper;
import com.example.test.bean.OrderInfoBO;
import com.example.test.service.TaskService;
import com.example.test.service.WybzService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WybzServiceImpl implements WybzService {


    @Autowired
    private WybzMapper wybzMapper;

    @Autowired
    private TaskService taskService;

    public List<OrderInfoBO> getOrderInfoByCreateTime(String CREATE_TIME){
        List<OrderInfoBO> orderInfoList = wybzMapper.getOrderInfoByCreateTime(CREATE_TIME);
        for (OrderInfoBO orderInfoBO : orderInfoList) {


            //物业保修才需要
//            String user_name = orderInfoBO.getUSER_NAME();
//            StringBuilder stringBuilder = new StringBuilder(user_name);
//            stringBuilder.replace(1, 2, "*");
//            user_name = stringBuilder.toString();
//            orderInfoBO.setUSER_NAME(user_name);

            // 学生注册才需要
//            orderInfoBO.setTYPE_NAME("恭喜你完成注册");


        }
        return orderInfoList;
    }

    @Override
    public void sendMsg(List<OrderInfoBO> list) {
//        String imAccount = wybzMapper.getImByKeyId(keyId);
        String msg="";
        for (OrderInfoBO o: list) {
//            msg = o.getSTORIED()+o.getADDRESS()+"的报修:"+o.getDESCRIBE()+"已经3天未处理，请留意。";
            msg="try";
            taskService.send("200003376","wybx",msg);
        }

    }
}
